package com.erclab.xpresso.formelements
{
	import mx.controls.TextInput;
	
	import mx.controls.Label;
	import mx.core.UIComponent;
	import mx.events.DragEvent;
	import mx.events.MoveEvent;
	import mx.events.ItemClickEvent;
	import mx.events.FlexMouseEvent;

	public class TextInput extends mx.controls.TextInput implements FormElement
	{
		
		protected var destinationColumn:String;
		
		public function getValue():String
		{
			return String(this.text);
		}
		
		public function getName():String
		{
			return String(this.name);
		}
		
		public function createLabel(attachingElement:UIComponent, label:String):void{
			if (this.visible){
				var myLabel:mx.controls.Label = new mx.controls.Label();
				myLabel.x = this.x - 100;
				myLabel.y = this.y;
				myLabel.text = label;
				attachingElement.addChild(myLabel);
				
				// Add the dragdropimage
				/*var hand:Image = new Image();
				hand.source = "../xpresso/html/images/Hand.gif";
				hand.x = this.x + 120;
				hand.y = this.y;
				attachingElement.addChild(hand);
				hand.addEventListener(MouseEvent.CLICK, dragging, false, 0, false);*/
			}
		}
		
		
		public function setValue(value:String):void {
			this.text = value;
		}
		
		public function getAttribute(attribute:String):String{
			return this[attribute];
		}
		
		public function setAttribute(attribute:String, attributeValue:String):void{
			this[attribute] = attributeValue;
		}

		public function prepareForInsert():void{
			this.text = "";
		}
	}
}